package com.shijunhao.graduation.controller.system;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.shijunhao.graduation.annotations.OperationLog;
import com.shijunhao.graduation.domain.bean.ResultCode;
import com.shijunhao.graduation.domain.entity.SystemFileInfo;
import com.shijunhao.graduation.service.system.ISystemFileInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author shijunhao
 * @since 2022-03-07
 */
@RestController
@RequestMapping("/system-file-info")
@Api(tags = "文件管理")
public class SystemFileInfoController {


    private final ISystemFileInfoService systemFileInfoService;

    @Autowired
    public SystemFileInfoController(ISystemFileInfoService systemFileInfoService) {
        this.systemFileInfoService = systemFileInfoService;
    }

    @GetMapping("list")
    @ApiOperation("文件列表")
    public ResultCode<List<SystemFileInfo>> list(){
        return ResultCode.success(systemFileInfoService.listByCondition(new QueryWrapper<>()));
    }

    @GetMapping("info/{id}")
    @ApiOperation("文件信息")
    public ResultCode<SystemFileInfo> info(@PathVariable Long id){
        return ResultCode.success(systemFileInfoService.getById(id));
    }
}
